﻿namespace HiMap.CoordinateSystem
{
    using HiMap.Base;
    using System;

    public class Projection_GaussClass : HiMapPtrClass, IProjection, IHiMapPtr, IDisposable
    {
        public Projection_GaussClass(GaussProjectionType gaussprojection_type, bool has_zone)
        {
            base.m_InPtr = VC.KWG_GAUSSPROJECTION_CREATE_STANDARD((int) gaussprojection_type, has_zone);
            base.m_Used = false;
        }

        public Projection_GaussClass(int InPtr, bool Used)
        {
            base.m_InPtr = InPtr;
            base.m_Used = Used;
        }

        public Projection_GaussClass(int gaussprojection_type, double line)
        {
            base.m_InPtr = VC.KWG_GAUSSPROJECTION_CREATE_CUSTOM(gaussprojection_type, line);
            base.m_Used = false;
        }

        public void Dispose()
        {
            if (!base.m_Used && (base.m_InPtr != 0))
            {
                VC.KWG_PROJECTION_DELETE(base.m_InPtr);
                base.m_InPtr = 0;
            }
        }

        ~Projection_GaussClass()
        {
            if (!base.m_Used && (base.m_InPtr != 0))
            {
                VC.KWG_PROJECTION_DELETE(base.m_InPtr);
            }
        }

        void IProjection.ProjCal(ICoordinateSystem Cd, double longitude, double latitude, ref double X, ref double Y)
        {
            VC.KWG_PROJECTION_CAL(base.m_InPtr, Cd.InPtr, longitude, latitude, ref X, ref Y);
        }

        void IProjection.ProjInvCal(ICoordinateSystem Cd, double X, double Y, ref double longitude, ref double latitude)
        {
            CoordinateSystemClass class1 = (CoordinateSystemClass) Cd;
            VC.KWG_PROJECTION_INVCAL(base.m_InPtr, Cd.InPtr, X, Y, ref longitude, ref latitude);
        }

        string IProjection.Name
        {
            get
            {
                return "Gauss";
            }
        }

        ProjectionType IProjection.Type
        {
            get
            {
                return ProjectionType.Gauss;
            }
        }
    }
}

